package com.wn26.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import com.wn26.bean.Goods;
import com.wn26.dao.GoodsDao;
import com.wn26.utils.DataSourceUtils;

public class GoodsDaoImpl implements GoodsDao {

	@Override
	public List<Goods> listGoods() throws SQLException {
		QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource());
		return runner.query("SELECT* FROM goods ORDER BY goods_sell_num DESC ", new BeanListHandler<Goods>(Goods.class));
	}

}
